---
title: "Balancing algorithm report"
output:
  html_document:
    df_print: paged
editor_options:
  chunk_output_type: console
---

```{r,message=FALSE,echo=FALSE}
library(dplyr)
```

```{r,echo=FALSE}
# Supply a "MyData.csv" to the directory,
# where column 1 of csv is the ID
clean <- read.csv("estonia_clean.csv")
MyData=clean
MyData=select(MyData,Record.ID,joint,pol,sex,vot)
write.csv(MyData,"MyData.csv",row.names = F)
MyData <- read.csv("MyData.csv")
```

# Python (config = code) 
```{python engine.path="/usr/bin/python3.5",results='hide'}
import sys
sys.path.append('/home/shared/data/balancing/')
import inject_v2
config = "{1: {'degreeHigh':19.6,'noDegreeHigh':29.6,'degreeLow':22.3,'noDegreeLow':28.5}},{2: {'interest':54.7,'LowInterest':45.3}},{3: {'Male':50.0,'Female':50.0}},{4: {'REF':20.20,'KESK':18.57,'IND':15.04,'IRL':11.57,'SDE':11.27,'EKRE':3.35,'Undec':20.00}}"

filename = '/home/fernando/Misc/bjpolFinal/Estonia/MyData.csv'

inject_v2.run(config, filename, "/home/fernando/Misc/bjpolFinal/Estonia/myBal", 2, 0, 0)
```
